From: Matthias Clasen Date: Thu, 16 Dec 2021 00:20:00 +0000 (-0500) Subject: inspector: Details about touchpad events X-Git-Tag: archive/raspbian/4.6.5+ds-1+rpi1~1^2~91^2^2~45^2~3 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=69b160cfe8e9f9307fb746c4ecc3c00d17e0af92;p=gtk4.git inspector: Details about touchpad events Useful to have for debugging these. --- diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c index f626e8690a..09114206e4 100644 --- a/gtk/inspector/recorder.c +++ b/gtk/inspector/recorder.c @@ -1398,6 +1398,19 @@ axis_name (GdkAxisUse axis) return name[axis]; } +static const char * +gesture_phase_name (GdkTouchpadGesturePhase phase) +{ + const char *name[] = { + "Begin", + "Update", + "End", + "Cancel" + }; + + return name[phase]; +} + static void populate_event_properties (GtkListStore *store, GdkEvent *event) @@ -1406,6 +1419,7 @@ populate_event_properties (GtkListStore *store, GdkDevice *device; GdkDeviceTool *tool; double x, y; + double dx, dy; char *tmp; GdkModifierType state; @@ -1508,6 +1522,25 @@ populate_event_properties (GtkListStore *store, add_boolean_row (store, "Implicit", gdk_grab_broken_event_get_implicit (event)); break; + case GDK_TOUCHPAD_SWIPE: + case GDK_TOUCHPAD_PINCH: + add_text_row (store, "Phase", gesture_phase_name (gdk_touchpad_event_get_gesture_phase (event))); + add_int_row (store, "Fingers", gdk_touchpad_event_get_n_fingers (event)); + gdk_touchpad_event_get_deltas (event, &dx, &dy); + tmp = g_strdup_printf ("%.2f %.f2", dx, dy); + add_text_row (store, "Delta", tmp); + g_free (tmp); + if (type == GDK_TOUCHPAD_PINCH) + { + tmp = g_strdup_printf ("%.2f", gdk_touchpad_event_get_pinch_angle_delta (event)); + add_text_row (store, "Angle Delta", tmp); + g_free (tmp); + tmp = g_strdup_printf ("%.2f", gdk_touchpad_event_get_pinch_scale (event)); + add_text_row (store, "Scale", tmp); + g_free (tmp); + } + break; + default: /* FIXME */ ;